/*
 * # iohao.com . 渔民小镇
 * Copyright (C) 2021 - present double joker （262610965@qq.com） . All Rights Reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.xy.springboot.game.task.action;

import com.iohao.game.action.skeleton.annotation.ActionController;
import com.iohao.game.action.skeleton.annotation.ActionMethod;
import com.iohao.game.action.skeleton.core.flow.FlowContext;
import com.xy.springboot.game.common.constant.cmd.TaskCmdModule;
import com.xy.springboot.game.common.data.ResultData;
import com.xy.springboot.game.common.data.TaskData;
import com.xy.springboot.game.task.service.TaskService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 班级相关 action
 *
 * @author 渔民小镇
 * @date 2022-07-10
 */
@Slf4j
@Component
@AllArgsConstructor
@ActionController(TaskCmdModule.CMD)
public class TaskAction {
    private  final TaskService taskService;

    @ActionMethod(TaskCmdModule.TASK_LIST)
    public List<TaskData> TaskList(List<TaskData> taskData, FlowContext flowContext) {
        return taskService.getTaskList(flowContext);
    }

    @ActionMethod(TaskCmdModule.TASK_OBJECT)
    public ResultData<List<TaskData>> TaskObject(TaskData taskData, FlowContext flowContext) {
        return ResultData.success(taskService.getTaskList(flowContext));
    }

}
